<?php 

$argc > 1 ? $plural = 's' : $plural = ''; 

$version = $argv[1];

$header = "/*BenixJS VFS Spec version:".$version."*/\n";

$license = "/*
 * Copyright 2009 Douglas Lockamy, dlockamy_at_gmail.com
 * All rights reserved. Distributed under the terms of the MIT License.
 */\n\n";

if($argc < 3)
{
	fwrite(STDOUT,"Must supply code argument, js or c \n");

	return -1;
}

if($argv[2] == 'js')
{
	$jsFile = 'benixJS/benix/api.js';
	$jsH = fopen($jsFile,'w') or die("can't open file");

	$jsAPI = $license.$header." 
function fileNode() {
    fileNode.Name = \"\";
    fileNode.meta = 0;
    fileNode.next = 0;
    fileNode.prev = 0;
    fileNode.Data = 0;
    fileNode.Type = 0;
    fileNode.Parent = 0;
};\n\n
function mountNode() {
    fsName = \"\";
    serverAddress = \"\";
    fsSessionID = \"\";
    classObj = 0;
    Parent = 0;
};";

	fwrite($jsH,$jsAPI);

	return 0;

}
if($argv[2] == 'c')
{

	$cFile = 'include/api.h';
	$cH = fopen($cFile,'w') or die("can't open file");

	$cAPI = "BenixC VFS Spec version:".$version;

	fwrite($cH,$cAPI);

	return 0;
}

else
	fwrite(STDOUT,"Unknown Error \n");
?>